<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>事件的基本使用</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>

<body>
    <!-- 准备好一个容器 -->
    <div id="root">
        <h2>欢迎来到{{name}}学习</h2>
        <button @click="showInfo1">点我提示信息1</button>
        <button @click="showInfo2(66)">点我提示信息2</button>
    </div>
</body>
<script type="text/javascript">
    Vue.config.productionTip = false

    function showInfo() {
        alert('同学你好')
    }

    const mv = new Vue({
        el: '#root',
        data: {
            name: '尚硅谷',
        },
        methods: {
            showInfo1(event) {
                // console.log(event.target.innerText)
                // console.log(this)//此处的this是vm
                alert('同学你好!')
            },
            showInfo2(event,number) {
                console.log(event,number)
                // console.log(event.target.innerText)
                // console.log(this)//此处的this是vm
                alert('同学你好!!')
            }
        }
    })
</script>

</html>